package com.frogs.ucenter.dao.ibatis;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.frogs.framework.base.dao.ibatis.BaseDaoIbatis;
import com.frogs.framework.util.PageList;
import com.frogs.ucenter.dao.UserRechargeStrategyDao;
import com.frogs.ucenter.entity.UserRechargeStrategy;
import com.ibatis.sqlmap.client.SqlMapClient;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

@Repository("userRechargeStrategyDao")
public class UserRechargeStrategyDaoImpl extends BaseDaoIbatis<UserRechargeStrategy> implements UserRechargeStrategyDao {

    public UserRechargeStrategyDaoImpl() {
        super();
        setNameSpace( "user_recharge_strategy" );
    }

    @Required
    @Autowired
    public void setSqlMapClientAutowired(SqlMapClient sqlMapClient) {
        super.setSqlMapClient( sqlMapClient );
    }

    @Override
	public List<Map<String, Object>> selectNumTypeByMap(
			Map<String, Object> params) throws Exception {
		SqlMapClient sqlMapClient = getSqlMapClientTemplate().getSqlMapClient();
		return sqlMapClient.queryForList(getNameSpace() + ".selectNumTypeByMap", params);
	}
    @Override
    public List<Map<String, Object>> selectRatioTypeByMap(
    		Map<String, Object> params) throws Exception {
    	SqlMapClient sqlMapClient = getSqlMapClientTemplate().getSqlMapClient();
    	return sqlMapClient.queryForList(getNameSpace() + ".selectRatioTypeByMap", params);
    }

	@Override
	public List<Map<String, Object>> selectNumTypePointByMap(
			Map<String, Object> params) throws Exception {
		SqlMapClient sqlMapClient = getSqlMapClientTemplate().getSqlMapClient();
		return sqlMapClient.queryForList(getNameSpace() + ".selectNumTypePointByMap", params);
	}

	@Override
	public List<Map<String, Object>> selectRatioTypePointByMap(
			Map<String, Object> params) throws Exception {
    	SqlMapClient sqlMapClient = getSqlMapClientTemplate().getSqlMapClient();
    	return sqlMapClient.queryForList(getNameSpace() + ".selectRatioTypePointByMap", params);
	}
	
	@Override
	public PageList<Map<String, Object>> selectUserStrategyByMap(
			Map<String, Object> params, int pageNo, int pageSize) {
		return (PageList<Map<String, Object>>) queryforPageList(getNameSpace() + ".selectStrategyByMap", params, pageNo, pageSize, true);
	}
}